package cn.itcast.producer;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.HashMap;
import java.util.Map;

public class Send {
    public static void main(String[] args) throws Exception {
        // 创建容器
        ClassPathXmlApplicationContext ac =
                new ClassPathXmlApplicationContext("classpath:spring/applicationContext-rabbitmq-producer.xml");


        // 从容器中获取对象
        RabbitTemplate template = ac.getBean(RabbitTemplate.class);

        // 发送消息
        Map<String,String> map = new HashMap<>();
        map.put("email","610731230@qq.com");
        template.convertAndSend("msg.email",map);

        ac.close();
    }
}